const TOKEN_KEY = 'token';
const INIT_REGISTER_KEY = 'init_register_key';
const isLogin = () => {
  return !!localStorage.getItem(TOKEN_KEY);
};

const isInitRegister = () => {
  // return false;
  return !!localStorage.getItem(INIT_REGISTER_KEY);
};


const getInitRegisterKey = () => {
  return localStorage.getItem(INIT_REGISTER_KEY);
};

export const setInitRegisterKey = (isRegister: string) => {
  localStorage.setItem(INIT_REGISTER_KEY, isRegister);
};

const clearInitRegisterKey = () => {
  localStorage.removeItem(INIT_REGISTER_KEY);
};


const getToken = () => {
  return localStorage.getItem(TOKEN_KEY);
};

const setToken = (token: string) => {
  localStorage.setItem(TOKEN_KEY, token);
};

const clearToken = () => {
  localStorage.removeItem(TOKEN_KEY);
};

export { isLogin, getToken, setToken, clearToken, isInitRegister,clearInitRegisterKey };
